﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 药品信息管理
{
    public partial class Loading : Form
    {
        private IAsyncResult m_State;
        private AsyncCallback m_callBack;
        private delegate void closeDelegate();
        ///   <summary> 
        ///   异步调用结束的时候调用以关闭窗口 
        ///   </summary> 
        public AsyncCallback CallBack
        {
            get { return m_callBack; }
        }
        ///   <summary> 
        ///   异步调用的状态 
        ///   </summary> 
        public IAsyncResult State
        {
            set { m_State = value; }
        } 

        public Loading()
        {
            m_callBack = new AsyncCallback(this.callBack); 

        }
        ///   <summary> 
        ///   回调方法定义 
        ///   </summary> 
        ///   <param   name= "ir "> </param> 
        private void callBack(IAsyncResult ir)
        {
            this.closeForm();
        }


        ///   <summary> 

        ///   关闭窗口 

        ///   </summary> 

        private void closeForm()
        {

            if (this.InvokeRequired)
            {

                closeDelegate cd = new closeDelegate(this.closeForm);

                this.Invoke(cd);

                return;

            }

            this.Close();

        } 
    }
}